package com.itheima.Service.Impl;

import com.itheima.Dao.Impl.UserDaoImpl;
import com.itheima.Dao.UserDao;
import com.itheima.Service.UserService;
import com.itheima.domain.User;

import java.util.List;


public class UserServiceImpl implements UserService {
    private UserDao dao = new UserDaoImpl();


    @Override
    public boolean Login(String username, String password) {

        List<User> list = dao.Login(username,password);
        //先假设用户名密码不对
        boolean flag=false;

        for (User user : list) {
            if (user.getUsername().equals(username)&&user.getPassword().equals(password)) {
                flag=true;
            }
        }
        return flag;



    }
}
